<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="viewport"
        content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            background-color: pink;
        }

        .div {
            color: rgb(135, 235, 160);
            font-size: 25px;
            text-align: center;
            margin: 30% auto;
        }
    
			

    </style>
</head>

<body>
    <div class="div">

    </div>

    <div class="box">
        <!-- 方块 -->
        <div class="div-1"></div>
        <!-- 两个圆 -->
        <div class="div-2"></div>
        <div class="div-2 div-3"></div>
    </div>
    <script>
        var div = document.querySelector('div');
        var xingxing = new Date(2020, 9, 24, 05, 05, 00).getTime();
        console.log(xingxing);
        var timer = setInterval(function () {
            var now = new Date().getTime();

            var shiCha = xingxing - now;

            //清除
            if (shiCha <= 0) {
                window.clearInterval(timer);
                return;
            }

            var day = Math.floor(shiCha / 1000 / 60 / 60 / 24);
            if (day <= 10) {
                day = '0' + day;
            }
            var hour = Math.floor(shiCha / 1000 / 60 / 60 % 24);
            if (hour <= 10) {
                hour = '0' + hour;
            }
            var minute = Math.floor(shiCha / 1000 / 60 % 60);
            if (minute <= 10) {
                minute = '0' + minute;
            }
            var second = Math.floor(shiCha / 1000 % 60);
            if (second <= 10) {
                second = '0' + second;
            }
            var milliSecond = Math.floor(shiCha % 1000);
            if (milliSecond <= 1000) {
                milliSecond = '0' + milliSecond;
            } else if (milliSecond <= 100) {
                milliSecond = '00' + milliSecond;
            } else if (milliSecond <= 10) {
                milliSecond = '000' + milliSecond;
            }
            var str = day + '天' + hour + '小时' + minute + '分钟' + second + '秒' + '</br>' + milliSecond + '毫秒'
            div.innerHTML = str
        }, 10)
    </script>
</body>

</html>